package com.ruoyi.controller;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.domain.ZhwyChargeitem;
import com.ruoyi.service.IZhwyChargeitemService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.ZhwySftj;
import com.ruoyi.service.IZhwySftjService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 收费统计Controller
 * 
 * @author ruoyi
 * @date 2024-05-10
 */
@RestController
@RequestMapping("/system/sftj")
public class ZhwySftjController extends BaseController
{
    @Autowired
    private IZhwySftjService zhwySftjService;

    @Autowired
    private IZhwyChargeitemService zhwyChargeitemService;

    /**
     * 查询收费统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:sftj:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZhwySftj zhwySftj)
    {
        startPage();
        List<ZhwySftj> list = zhwySftjService.selectZhwySftjList(zhwySftj);
        return getDataTable(list);
    }

    /**
     * 导出收费统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:sftj:export')")
    @Log(title = "收费统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZhwySftj zhwySftj)
    {
        List<ZhwySftj> list = zhwySftjService.selectZhwySftjList(zhwySftj);
        ExcelUtil<ZhwySftj> util = new ExcelUtil<ZhwySftj>(ZhwySftj.class);
        util.exportExcel(response, list, "收费统计数据");
    }

    /**
     * 获取收费统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:sftj:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(zhwySftjService.selectZhwySftjById(id));
    }

    /**
     * 新增收费统计
     */
    @PreAuthorize("@ss.hasPermi('system:sftj:add')")
    @Log(title = "收费统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZhwySftj zhwySftj)
    {
        return toAjax(zhwySftjService.insertZhwySftj(zhwySftj));
    }

    /**
     * 修改收费统计
     */
    @PreAuthorize("@ss.hasPermi('system:sftj:edit')")
    @Log(title = "收费统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZhwySftj zhwySftj)
    {
        return toAjax(zhwySftjService.updateZhwySftj(zhwySftj));
    }

    /**
     * 删除收费统计
     */
    @PreAuthorize("@ss.hasPermi('system:sftj:remove')")
    @Log(title = "收费统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zhwySftjService.deleteZhwySftjByIds(ids));
    }


}
